package com.itheima.book.entry;

import com.itheima.book.controller.Book2Controller;
import com.itheima.book.controller.BookBaseController;
import com.itheima.book.controller.BookController;

import java.util.Random;

public class BookEntry {
    public static void main(String[] args) {
        //创建BookController对象，调用start方法启动程序
        /*Book2Controller bookController = new Book2Controller();
        bookController.start();*/

       /* Random r = new Random();
        int i = r.nextInt(2);

        switch (i){
            case 0:
                BookController bookController = new BookController();
                bookController.start();
                break;
            case 1:
                Book2Controller book2Controller = new Book2Controller();
                book2Controller.start();
                break;
        }*/

        BookBaseController bookBaseController = getBookBaseController();
        bookBaseController.start();

    }

    public static BookBaseController getBookBaseController() {
        Random r = new Random();
        int i = r.nextInt(2);

        switch (i) {
            case 0:
                return new BookController();

            case 1:
                return new Book2Controller();
        }


        return null;
    }

}
